'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All rights reserved.
.\" Copyright 2012 Marcel Telka <marcel@telka.sk>
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CDRW 1 "May 13, 2017"
.SH NAME
cdrw \- CD read and write
.SH SYNOPSIS
.LP
.nf
\fBcdrw\fR \fB-i\fR [\fB-vSCO\fR] [\fB-d\fR \fIdevice\fR] [\fB-p\fR \fIspeed\fR] [\fIimage-file\fR]
.fi

.LP
.nf
\fBcdrw\fR \fB-a\fR [\fB-vSCO\fR] [\fB-d\fR \fIdevice\fR] [\fB-p\fR \fIspeed\fR] [\fB-T\fR \fIaudio-type\fR] \fIaudio-file1\fR
     [\fIaudio-file2\fR]...
.fi

.LP
.nf
\fBcdrw\fR \fB-x\fR [\fB-v\fR] [\fB-d\fR \fIdevice\fR] [\fB-T\fR \fIaudio-type\fR] \fItrack-number\fR \fIout-file\fR
.fi

.LP
.nf
\fBcdrw\fR \fB-c\fR [\fB-vSC\fR] [\fB-d\fR \fIdevice\fR] [\fB-p\fR \fIspeed\fR] [\fB-m\fR \fItmp-dir\fR]
     [\fB-s\fR \fIsrc-device\fR]
.fi

.LP
.nf
\fBcdrw\fR \fB-b\fR [\fB-v\fR] [\fB-d\fR \fIdevice\fR] all | session | fast
.fi

.LP
.nf
\fBcdrw\fR \fB-L\fR [\fB-v\fR] [\fB-d\fR \fIdevice\fR]
.fi

.LP
.nf
\fBcdrw\fR \fB-M\fR [\fB-v\fR] [\fB-d\fR \fIdevice\fR]
.fi

.LP
.nf
\fBcdrw\fR \fB-l\fR [\fB-v\fR]
.fi

.LP
.nf
\fBcdrw\fR \fB-h\fR
.fi

.SH DESCRIPTION
.LP
The \fBcdrw\fR command provides the ability to create data and audio CDs. This
command also provides the ability to extract audio tracks from an audio CD and
to create data DVDs. The CD or DVD device must be MMC-compliant to create a CD
or DVD with the \fBcdrw\fR command.
.sp
.LP
\fBcdrw\fR searches for a CD or DVD writer connected to the system, unless you
specify a device with the \fB-d\fR option. If \fBcdrw\fR finds a single such
device, it uses that device as the default CD or DVD writer for the command.
.sp
.LP
When more than one CD or DVD writer is connected to the system, use the
\fB-d\fR option to indicate which device is desired. The device name can be
specified in one of the following ways: /dev/rdsk/cNtNdNsN, cNtNdNsN, cNtNdN,
or a name used by volume manager, such as \fBcdrom\fR or \fBcdrom1\fR. Using
the \fB-l\fR option provides a list of CD or DVD writers.
.sp
.LP
For instructions on adding a USB-mass-storage-class-compliant CD-RW or DVD-RW
device to your system, see \fBscsa2usb\fR(4D).
.SS "Creating Data CDs"
.LP
When creating data CDs, \fBcdrw\fR uses the Track-At-Once mode of writing. Use
the \fB-i\fR option to specify a file that contains the data to write on CD
media. If you don't specify this option, \fBcdrw\fR reads data from standard
input.
.sp
.LP
In either case, the data is typically prepared by using the \fBmkisofs\fR
command to convert the file and file information into the ISO 9660 format
used on CDs. See the examples that include use of this command.
.SS "Creating Data DVDs"
.LP
\fBcdrw\fR can create single-session data DVDs on DVD+RW or DVD-RW devices
using images generated from \fBmkisofs\fR. These disks can be mounted as HSFS
file systems. When making data DVDs, \fBcdrw\fR uses Disk-At-Once (DAO) mode of
writing, which closes the media when writing is completed and prevents any
further sessions from being added. The image should be prepared in advance when
writing an image to the DVD media since DAO mode requires that the size of the
image be known in advance.
.SS "Creating Audio CDs"
.LP
Use the \fB-a\fR option to create an audio CD. Single or multiple audio files
can be specified with this option. All of the audio files should be in a
supported audio format. Currently approved formats are:
.sp
.ne 2
.na
\fBsun\fR
.ad
.RS 7n
Sun .au files with data in Red Book CDDA form
.RE

.sp
.ne 2
.na
\fBwav\fR
.ad
.RS 7n
RIFF (.wav) files with data in Red Book CDDA form
.RE

.sp
.ne 2
.na
\fBcda\fR
.ad
.RS 7n
\&.cda files having raw CD audio data (that is, 16 bit PCM stereo at 44.1 KHz
sample rate in little-endian byte order)
.RE

.sp
.ne 2
.na
\fBaur\fR
.ad
.RS 7n
\&.aur files having raw CD data in big-endian byte order
.RE

.sp
.LP
If no audio format is specified, \fBcdrw\fR tries to identify the audio file
format based on the file extension. The case of the characters in the extension
is ignored. If a format is specified using the \fB-T\fR option, it is assumed
to be the audio file type for all the files specified. Also, using the \fB-c\fR
option closes the session after writing the audio tracks. Therefore, the tracks
to be written should be specified in a single command line.
.SS "Extracting Audio"
.LP
\fBcdrw\fR can also be used for extracting audio data from an audio CD with the
\fB-x\fR option. The CD should have tracks in Red Book CDDA form. By default,
the output format is based on the file extension. A user can specify a
\fBsun\fR, \fBwav\fR, \fBcda\fR, or \fBaur\fR output format with the \fB-T\fR
option.
.SS "Copying CDs"
.LP
\fBcdrw\fR can be used to copy single session data CD-ROMs and Red Book audio
CDs. When copying a CD, \fBcdrw\fR looks for a specified source device. If no
source device is specified when using the \fB-c\fR option, the current CD
writer is assumed to be the source. \fBcdrw\fR extracts the track or tracks
into a temporary file and looks for a blank writable CD-R/RW media in the
current CD writer. If no media is found, insert a blank writable CD media in
the current CD writer. If the default temporary directory does not have enough
space, an alternate directory can be specified by using the \fB-m\fR option.
.SS "Erasing CD-RW or DVD-RW Media"
.LP
Users have to erase the CD-RW media before it can be rewritten. With the
\fB-b\fR option, the following flavors of erasing are currently supported:
.sp
.ne 2
.na
\fB\fBsession\fR\fR
.ad
.RS 11n
Erases the last session.
.RE

.sp
.ne 2
.na
\fB\fBfast\fR\fR
.ad
.RS 11n
Minimally erases the media.
.RE

.sp
.ne 2
.na
\fB\fBall\fR\fR
.ad
.RS 11n
Erases the entire media.
.RE

.sp
.LP
If the session erasing type is used, \fBcdrw\fR erases the last session. If
there is only one session recorded on the CD-RW (for example, a data or audio
CD-RW created by this tool), then session erasing only erases the portion that
is recorded, leaving behind a blank disk. This is faster than erasing the
entire media. For DVD media, using the \fB-b session\fR erases the whole media.
.sp
.LP
The \fBfast\fR erasing type minimally erases the entire media by removing the
\fBPMA\fR and \fBTOC\fR of the first session. It does not erase the user data
and subsequent tracks on the media, but the media is treated as if it were a
blank disk. If a complete erase is of the media is necessary, use the \fBall\fR
option.
.sp
.LP
The \fBall\fR erasing type should be used if it is a multisession disk, the
last session is not closed, or disk status is unknown, and you want to erase
the disk. With this type of erasing, \fBcdrw\fR erases the entire disk.
.sp
.LP
DVD+RW media does not support erasing. To re-use DVD+RW media, simply write a
new image onto the media. \fBcdrw\fR formats and overwrites the existing media
automatically.
.SS "Checking device-list or media-status"
.LP
You can list a system's CD or DVD writers by using the \fB-l\fR option. Also,
for a particular media, you can get the blanking status and table of contents
by using the \fB-M\fR option. The \fB-M\fR option also prints information about
the last session's start address and the next writable address. This
information, along with the \fB-O\fR option, can be used to create multisession
CDs. Refer to the \fBmkisofs\fR(8) man page for more information.
.SH OPTIONS
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
Creates an audio disk. At least one \fIaudio-file\fR name must be specified. A
CD can not have more than 99 audio tracks, so no more than 99 audio files can
be specified.
.RE

.sp
.ne 2
.na
\fB\fB-b\fR\fR
.ad
.RS 6n
Blanks CD-RW or DVD-RW media. The type of erasing must be specified by the
\fBall\fR, \fBfast\fR, or \fBsession\fR argument. DVD+RW media does not support
blanking, but can be rewritten without the need for blanking.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.RS 6n
Copies a CD. If no other argument is specified, the default CD writing device
is assumed to be the source device as well. In this case, the copy operation
reads the source media into a temporary directory and prompts you to place a
blank media into the drive for the copy operation to proceed.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 6n
This option is obsolete.
.sp
This option used to cause \fBcdrw\fR to query the drive to determine media
capacity.  This is now the default behavior.
.RE

.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 6n
Specifies the CD or DVD writing device.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.RS 6n
Help. Prints usage message.
.RE

.sp
.ne 2
.na
\fB\fB-i\fR\fR
.ad
.RS 6n
Specifies the image file for creating data CDs or DVDs. The file size should be
less than what can be written on the media. Also, consider having the file
locally available instead of having the file on an NFS-mounted file system. The
CD writing process expects data to be available continuously without
interruptions.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 6n
Lists all the CD or DVD writers available on the system.
.RE

.sp
.ne 2
.na
\fB\fB-L\fR\fR
.ad
.RS 6n
Closes the disk. If the media was left in an open state after the last write
operation, it is closed to prevent any further writing. This operation can only
be done on re-writable CD-RW media.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 6n
Uses an alternate temporary directory instead of the default temporary
directory for storing track data while copying a CD or DVD. An alternate
temporary directory might be required because the amount of data on a CD can be
huge. For example, the amount of data can be as much as 800 Mbytes for an 80
minute audio CD and 4.7 Gbytes for a DVD. The default temporary directory might
not have that much space available.
.RE

.sp
.ne 2
.na
\fB\fB-M\fR\fR
.ad
.RS 6n
Reports media status. \fBcdrw\fR reports if the media is blank or not, its
table of contents, the last session's start address, and the next writable
address if the disk is open. DVD+RW does not support erasing and always has
some content on the media.
.RE

.sp
.ne 2
.na
\fB\fB-O\fR\fR
.ad
.RS 6n
Keeps the disk open. \fBcdrw\fR closes the session, but it keeps the disk open
so that another session can be added later on to create a multisession disk.
.RE

.sp
.ne 2
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
Sets the CD writing speed. For example, \fB-p\fR \fB4\fR sets the speed to 4X.
If this option is not specified, \fBcdrw\fR uses the default speed of the CD
writer. If this option is specified, \fBcdrw\fR tries to set the drive write
speed to this value, but there is no guarantee of the actual speed that is used
by the drive.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 6n
Specifies the source device for copying a CD or DVD.
.RE

.sp
.ne 2
.na
\fB\fB-S\fR\fR
.ad
.RS 6n
Simulation mode. In this mode, \fBcdrw\fR operates with the drive laser turned
off, so nothing is written to the media. Use this option to verify if the
system can provide data at a rate good enough for CD writing.
.sp
CD-R, CD-RW (not MRW formatted), DVD-R, and DVD-RW media support simulation
mode (\fB-S\fR). DVD-RAM, DVD+R, DVD+RW, any MRW-formatted media, and some
others do not support simulation mode (\fB-S\fR).
.RE

.sp
.ne 2
.na
\fB\fB-T\fR\fR
.ad
.RS 6n
Audio format to use for extracting audio files or for reading audio files for
audio CD creation. The \fIaudio-type\fR can be \fBsun\fR, \fBwav\fR, \fBcda\fR,
or \fBaur\fR.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
Verbose mode.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
Extracts audio data from an audio track.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRCreating a Data CD or DVD
.sp
.in +2
.nf
example% \fBcdrw -i /local/iso_image\fR
.fi
.in -2
.sp

.LP
\fBExample 2 \fRCreating a CD or DVD from a Directory
.sp
.LP
This example shows how to create a CD or DVD from the directory tree
\fB/home/foo\fR.

.sp
.in +2
.nf
example% \fBmkisofs -r /home/foo 2>/dev/null | cdrw -i -p 1\fR
.fi
.in -2
.sp

.LP
\fBExample 3 \fRExtracting an Audio Track Number
.sp
.LP
This example shows how to extract audio track number \fB1\fR to
\fB/home/foo/song1.wav\fR.

.sp
.in +2
.nf
example% \fBcdrw -x -T wav 1 /home/foo/song1.wav\fR
.fi
.in -2
.sp

.LP
\fBExample 4 \fRUsing \fBwav\fR Files
.sp
.LP
This example shows how to create an audio CD from \fBwav\fR files on disk.

.sp
.in +2
.nf
example% \fBcdrw -a song1.wav song2.wav song3.wav song4.wav\fR
.fi
.in -2
.sp

.LP
\fBExample 5 \fRErasing CD-RW or DVD-RW Media
.sp
.LP
This example shows how to erase rewritable media.

.sp
.in +2
.nf
example% \fBcdrw -b all\fR
.fi
.in -2
.sp

.LP
\fBExample 6 \fRCreating a Data CD or DVD with Multiple Drives
.sp
.LP
This example shows how to create a data CD or DVD on a system with multiple CD,
DVD-R, or DVD-RW drives.

.sp
.in +2
.nf
example% \fBcdrw -d c1t6d0s2 -i /home/foo/iso-image\fR
.fi
.in -2
.sp

.LP
\fBExample 7 \fRChecking Data Delivery Rate
.sp
.LP
This example shows how to verify that the system can provide data to a CD-RW or
a DVD drive at a rate sufficient for the write operation.

.sp
.in +2
.nf
example% \fBcdrw -S -i /home/foo/iso-image\fR
.fi
.in -2
.sp

.LP
\fBExample 8 \fRRunning at a Higher Priority
.sp
.LP
This example shows how to run \fBcdrw\fR at a higher priority (for root user
only).

.sp
.in +2
.nf
example# \fBpriocntl -e -p 60 cdrw -i /home/foo/iso-image\fR
.fi
.in -2
.sp

.LP
\fBExample 9 \fRCreating a Multi-session Disk
.sp
.LP
This examples shows how to create the first session image by using
\fBmkisofs\fR and recording it onto the disk without closing the disk.

.sp
.in +2
.nf
example% \fBcdrw -O -i /home/foo/iso-image\fR
.fi
.in -2
.sp

.sp
.LP
Additional sessions can be added to an open disk by creating an image with
\fBmkisofs\fR using the session start and next writable address reported by
\fBcdrw\fR.

.sp
.in +2
.nf
example% \fBcdrw -M\fR

Track No. |Type    |Start address
----------+--------+-------------
 1        |Data    | 0
Leadout   |Data    | 166564

Last session start address: 162140
Next writable address: 173464
.fi
.in -2
.sp

.sp
.in +2
.nf
example% \fBmkisofs -o /tmp/image2 -r -C 0,173464 -M \e
   /dev/rdsk/c0t2d0s2 /home/foo\fR
.fi
.in -2
.sp

.SH SEE ALSO
.LP
.BR audioconvert (1),
.BR priocntl (1),
.BR scsa2usb (4D),
.BR sd (4D),
.BR policy.conf (5),
.BR attributes (7),
.BR rbac (7),
.BR mkisofs (8)
.sp
.LP
\fISystem Administration Guide: Devices and File Systems\fR
.SH NOTES
.LP
The CD writing process requires data to be supplied at a constant rate to the
drive. Keep I/O activity to a minimum and shut down any related I/O
applications while writing CDs.
.sp
.LP
When making copies or extracting audio tracks, use an MMC compliant source
CD-ROM drive. The CD writer can be used for this purpose.
.sp
.LP
Before writing a CD, ensure that the media is blank by using the \fB-M\fR
option. You can use the \fB-S\fR simulation mode to test the system to make
sure it can provide data at the required rate. \fBcdrw\fR turns on buffer
underrun protection for drives that support it and recovers from most stalls.
If the system is not able to provide data at a constant rate or frequent
stalling occurs, you can lower the speed by using the \fB-p\fR option. You can
also try to run \fBcdrw\fR at a higher priority by using the \fBpriocntl\fR(1)
command.
.sp
.LP
If you know that the CD-R/RW drive can operate at different write speeds, use
the \fB-p\fR option. Some commercially available drives handle the drive speed
setting command differently, so use this option judiciously.
.sp
.LP
The \fBcdrw\fR command uses \fBrbac\fR(7) to control user access to the
devices. By default, \fBcdrw\fR is accessible to all users but can be
restricted to individual users. Refer to the \fISystem Administration Guide:
Devices and File Systems\fR for more information.
.sp
.LP
To burn CDs as a non-root user \fBhal\fR must be enabled and the user must be
on the console. \fBhal\fR, that is the \fBsvc:/system/hal\fR SMF service, is
enabled by default, therefore, typically this requires no special action.
.sp
.LP
The user must be logged onto the console. \fB/dev/console\fR is also correct.
Previously, users could log in remotely, for example, by using \fBtelnet\fR or
\fBssh\fR, and be able to burn CDs. This would work unless the administrator
had changed the default configuration to deny \fBsolaris.device.cdrw\fR
authorization. See \fBpolicy.conf\fR(5).
